From: Ximin Luo Date: Thu, 15 Feb 2018 14:31:12 +0000 (+0100) Subject: Turn --avoid-dev-deps into a -Z unstable flag X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~2^2~56^2~5 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=df5f7d688c7e6af2b2d445dfb04028ee9f41be08;p=cargo.git Turn --avoid-dev-deps into a -Z unstable flag --- diff --git a/src/bin/build.rs b/src/bin/build.rs index 9b576e922..b388c36f5 100644 --- a/src/bin/build.rs +++ b/src/bin/build.rs @@ -12,7 +12,6 @@ pub struct Options { flag_features: Vec, flag_all_features: bool, flag_no_default_features: bool, - flag_avoid_dev_deps: bool, flag_target: Option, flag_manifest_path: Option, flag_verbose: u32, @@ -64,7 +63,6 @@ Options: --features FEATURES Space-separated list of features to also build --all-features Build all available features --no-default-features Do not build the `default` feature - --avoid-dev-deps Avoid installing dev-dependencies if possible --target TRIPLE Build for the target triple --manifest-path PATH Path to the manifest to compile -v, --verbose ... Use verbose output (-vv very verbose/build.rs output) @@ -101,7 +99,7 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult { let root = find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())?; let mut ws = Workspace::new(&root, config)?; - if options.flag_avoid_dev_deps { + if config.cli_unstable().avoid_dev_deps { ws.set_require_optional_deps(false); } diff --git a/src/cargo/core/features.rs b/src/cargo/core/features.rs index 414e6a4a8..875f4e2df 100644 --- a/src/cargo/core/features.rs +++ b/src/cargo/core/features.rs @@ -234,6 +234,7 @@ pub struct CliUnstable { pub unstable_options: bool, pub offline: bool, pub no_index_update: bool, + pub avoid_dev_deps: bool, } impl CliUnstable { @@ -266,6 +267,7 @@ impl CliUnstable { "unstable-options" => self.unstable_options = true, "offline" => self.offline = true, "no-index-update" => self.no_index_update = true, + "avoid-dev-deps" => self.avoid_dev_deps = true, _ => bail!("unknown `-Z` flag specified: {}", k), } diff --git a/src/cargo/core/workspace.rs b/src/cargo/core/workspace.rs index 00e93a927..c2e1a3e4d 100644 --- a/src/cargo/core/workspace.rs +++ b/src/cargo/core/workspace.rs @@ -64,7 +64,8 @@ pub struct Workspace<'cfg> { // True if this workspace should enforce optional dependencies even when // not needed; false if this workspace should only enforce dependencies - // needed by the current configuration (such as in cargo install). + // needed by the current configuration (such as in cargo install). In some + // cases `false` also results in the non-enforcement of dev-dependencies. require_optional_deps: bool, }